import require from '@/utils/_require';

const API = {
  'SKULIST': '/admin/product/list',
  'ONSALE': '/admin/product/onSale',
  'CANCELSALE': '/admin/product/cancelSale',
  'GETSKUINFO': '/admin/product/getSkuInfo',
  'DELETESKU': '/admin/product/deleteSku',
}

// 获取sku信息列表
export const reqSkuList = function (page, limit) {
  return require({
    url: API.SKULIST + `/${page}/${limit}`,
    method: 'get'
  })
}

// 根据skuId上架
export const reqOnSale = function (skuId) {
  return require({
    url: API.ONSALE + `/${skuId}`,
    method: 'get'
  })
}

// 根据skuId下架
export const reqCancelSale = function (skuId) {
  return require({
    url: API.CANCELSALE + `/${skuId}`,
    method: 'get'
  })
}

// 获取skuInfo
export const reqGetSkuInfo = function (skuId) {
  return require({
    url: API.GETSKUINFO + `/${skuId}`,
    method: 'get'
  })
}

// 删除sku
export const reqDeleteSku = function (skuId) {
  return require({
    url: API.DELETESKU + `/${skuId}`,
    method: 'delete'
  })
}
